<ul>
    <li class="goods_class <?php if(!$is_site) echo 'other_nav'; ?> ">
        <div><i><img src="/statics/images/lei.png"></i>商品分类</div>
        <div class="all_goods_class  <?php if(!$is_site) echo 'hide'; ?>">
            <?php if(!empty($nav_category) && !empty($nav_category['data'])): ?>
            <ul>
            <?php $data_index = 1; ?>
                <?php foreach ($nav_category['data'] as $n_k => $n_v) :?>
                    <?php if(!empty($n_v['categories'])): ?>
                        <li class="category_item"  data-index="<?php echo $data_index; ?>">
                        <?php $data_index += 1; ?>
                        <?php $k_index=0; ?>
                        <?php foreach ($n_v['categories'] as $k => $v) :?>
                            <?php if($k_index!=0) echo '/' ?><a data-sid="<?php echo $v['sid']; ?>" href="/goods/list/category_id/<?php echo $v['sid'] ?>"><?php echo $v['name'] ?></a>
                            <?php $k_index= 1; ?>
                        <?php endforeach;?>
                        </li>
                    <?php endif; ?>
                <?php endforeach; ?>
            </ul>
            <?php endif; ?>
            <!-- 分类详细 -->
            <div class="class_box hide">
                <!-- 详细分类 -->
                <?php if(!empty($nav_category) && !empty($nav_category['data'])): ?>
                    <?php $data_index = 1; ?>
                    <?php foreach ($nav_category['data'] as $n_k => $n_v) :?>
                        <div data-index="<?php echo $data_index; ?>" class="goods_class_detail hide">
                            <ul>
                                
                            </ul>
                        </div>
                        <?php $data_index += 1; ?>
                    <?php endforeach; ?>
                <?php endif; ?>
            </div>
        </div>
    </li>
    <?php $site_nav_index = Yii::app()->session->get('site_nav_index'); ?>
    <li class="<?php if(!empty($site_nav_index) && $site_nav_index == 1) echo "hover_nav" ?>"><a href="/">首页</a></li>
    <!-- <li><a href="/shop/list">直营商家</a></li> -->
    <?php
    $buf_url = '';
    if (!empty($this->getController()->token)) {
       $sign = WxUtil::getSign(array('token'=>$this->getController()->token)) ;
        $buf_url = '/?token='.$this->getController()->token.'&sign='.$sign;
    }
      ?>
    <li style="display: none" class="<?php if(!empty($site_nav_index) && $site_nav_index == 2) echo "hover_nav" ?>"><a target="_blank" href="http://www.ftxmall.com<?php echo $buf_url?>">福天下联盟商家</a></li>
    <!-- <li><a href="">代销商</a></li> -->
    <li class="hide <?php if(!empty($site_nav_index) && $site_nav_index == 3) echo "hover_nav" ?>"><a href="/panicbuy/list">一元抢购</a></li>
    <li class="<?php if(!empty($site_nav_index) && $site_nav_index == 4) echo "hover_nav" ?>"><a href="/seckill/index">整点秒杀</a></li>
    <li class="hide <?php if(!empty($site_nav_index) && $site_nav_index == 5) echo "hover_nav" ?>"><a href="/feature/index">特色馆</a></li>
    <li class=" <?php if(!empty($site_nav_index) && $site_nav_index == 5) echo "hover_nav" ?>"><a href="/groupon/index">团购</a></li>
</ul>
<script type="text/javascript">
    $(function() {
        $(".all_goods_class>ul>li").each(function(){
        var data_index = $(this).data("index");
        var index =  $(this).index();
        var len = $('.goods_class_detail').eq(index).find('li').length;
        if (len == 0) {
            //$(this).find('a').each(function(){
                var sid = '';
            $(this).find('a').each(function(){
                var id = $(this).data('sid');
                if (sid =='') {
                    sid  = id;
                } else {
                    sid += ','+id;
                }
                console.log(id);
                console.log(sid);
            }) 
                $.ajax({
                    type:"GET",
                    dataType: "json",
                    url: "<?php echo $this->getController()->createUrl('/category/getson')?>",
                    data:{'sid':sid},
                    success: function(json){
                        if (json != '') {
                            if($('.goods_class_detail').eq(index).find('ul li').length ==0){
                                    $(json).each(function(i){
                                    $('.goods_class_detail').eq(index).find('ul').append("<li>"+
                                                                        "<span><a href='/goods/list?category_id="+json[i]['id']+"'> "+json[i]['name']+"</span>"+
                                                                        "<div>"+
                                                                        "</div>"+
                                                                    "</li>");
                                    if (json[i]['child_category'] != '') {
                                        $(json[i]['child_category']).each(function(j){
                                            $('.goods_class_detail').eq(index).find('div:last').append("<a href='/goods/list?category_id="+json[i]['child_category'][j]['id']+"'>"+json[i]['child_category'][j]['name']+"</a>");
                                        })
                                    }

                                })
                            }
                            
                        }
                    },
                    error:function(e){

                    }
                });//ajax end
            //});
        } 
    })
          $(".all_goods_class>ul>li").mouseover(function(){
        var data_index = $(this).data("index");
        var index =  $(this).index();
        var len = $('.goods_class_detail').eq(index).find('li').length;
         
        var len_nav = (".goods_class_detail").length;
        var you = 0;
        for(var e=0;e<len_nav;e++){
            if($(".goods_class_detail").eq(e).data("index")==data_index){
                you++;
                $(".class_box").removeClass("hide");

                $(".goods_class_detail").addClass("hide");
                $(".goods_class_detail").eq(e).removeClass("hide");
            }
        }
        if(you==0){
            $(".class_box").addClass("hide");
            $(".goods_class_detail").addClass("hide");
        }
    })
    });
</script>